package com.taobao.api.request;

import com.taobao.api.internal.util.RequestCheckUtils;
import java.util.Map;

import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.VideosQueryResponse;
import com.taobao.api.ApiRuleException;
/**
 * TOP API: taobao.videos.query request
 * 
 * @author auto create
 * @since 1.0, 2013-07-17 12:39:34
 */
public class VideosQueryRequest implements TaobaoRequest<VideosQueryResponse> {

	private Map<String, String> headerMap = new TaobaoHashMap();
	private TaobaoHashMap udfParams; // add user-defined text parameters
	private Long timestamp;

	/** 
	* 需要返回的视频对象字段。VideoItem结构体中所有字段均可返回；多个字段用“,”分隔；其中video_play_info中的播放url可选择性返回，其余属性全部返回；如果想返回整个子对象中所有url，那字段为video_play_info，如果是想返回子对象里面的字段，那字段为video_play_info.web_url。
	 */
	private String fields;

	/** 
	* 在淘宝视频中的应用key，该值向淘宝视频申请产生
	 */
	private Long videoAppKey;

	/** 
	* 视频id列表
	 */
	private String videoIds;

	public void setFields(String fields) {
		this.fields = fields;
	}
	public String getFields() {
		return this.fields;
	}

	public void setVideoAppKey(Long videoAppKey) {
		this.videoAppKey = videoAppKey;
	}
	public Long getVideoAppKey() {
		return this.videoAppKey;
	}

	public void setVideoIds(String videoIds) {
		this.videoIds = videoIds;
	}
	public String getVideoIds() {
		return this.videoIds;
	}

	public Long getTimestamp() {
		return this.timestamp;
	}

	public void setTimestamp(Long timestamp) {
		this.timestamp = timestamp;
	}

	public String getApiMethodName() {
		return "taobao.videos.query";
	}

	public Map<String, String> getTextParams() {		
		TaobaoHashMap txtParams = new TaobaoHashMap();
		txtParams.put("fields", this.fields);
		txtParams.put("video_app_key", this.videoAppKey);
		txtParams.put("video_ids", this.videoIds);
		if(this.udfParams != null) {
			txtParams.putAll(this.udfParams);
		}
		return txtParams;
	}

	public void putOtherTextParam(String key, String value) {
		if(this.udfParams == null) {
			this.udfParams = new TaobaoHashMap();
		}
		this.udfParams.put(key, value);
	}

	public Class<VideosQueryResponse> getResponseClass() {
		return VideosQueryResponse.class;
	}

	public void check() throws ApiRuleException {
		RequestCheckUtils.checkNotEmpty(fields,"fields");
		RequestCheckUtils.checkNotEmpty(videoAppKey,"videoAppKey");
		RequestCheckUtils.checkNotEmpty(videoIds,"videoIds");
		RequestCheckUtils.checkMaxListSize(videoIds,100,"videoIds");
	}

	public Map<String, String> getHeaderMap() {
		return headerMap;
	}
}
